home *** CD-ROM | disk | FTP | other *** search
/ Georgia Wildfire Prevention / Georgia Wildfire Prevention.iso / pc / media / dirs / BackUp / Firetower.dir / 00004_Script_Button Behavior < prev    next >
Text File  |  2002-10-11  |  3KB  |  85 lines

  1. --This behavior flashes a member at a desired rate and also allows it to work as a link to another frame.
  2. --PROPERTIES--
  3. --Hot: The member switched to (hot state).
  4. --FlashSpeed: The speed in which the sprite flashes measured in ticks (1/60th of a sec.)
  5. --WhichFrame: The frame junped to if pushed. Zero keeps the current frame.
  6. --Glowing: Lets the function know if the sprite is hot or cold.
  7. --RollOvr: The member switched to when rolled-over.
  8. --ButtonSound: The sound that will play when clicked. Channel 2 is reserved for short sounds.
  9. --TimeTracker: Times out the seconds between flashes.
  10. --SpNum: The sprite number of the sprite.
  11. --MyNum: The Member's number
  12.  
  13. property Hot, FlashSpeed, WhichFrame, Glowing, RollOvr, ButtonSound, MovieControl, TimeTracker, SpNum, MyNum
  14.  
  15. --Captures the spritenumber.
  16. on new me
  17.   SpNum = me.spritenum
  18.   MyNum=sprite(SpNum).member.number
  19. end
  20.  
  21. --Creates the dialog box for the behavior.
  22. on getpropertydescriptionlist me
  23.   set pList = [#Hot:[#comment: "What is the cast member name for the Hot state?", #format: #string, #default: ""], \
  24.  #RollOvr: [#comment: "Which member would you like to use for the rollover?", #format: #string, #default: ""], \
  25.  #ButtonSound:[#comment: "What sound would you like to play when the button is pressed?",#format:#string,#default:"Click"],\
  26.  #MovieControl: [#comment: "Is this button used to control a movie?",#format: #string,#range: ["Play", "Pause","Stop","Rewind","Fast Forward", "No"],#default:"No"], \
  27.  #FlashSpeed:[#comment:  "How often would you like the member to flash (ticks)?", #format: #integer, #range: [#min: 0, #max: 60], #default: 30], \
  28.  #WhichFrame: [#comment: "Which frame would you like to jump to?", #format:#integer, default: "0"]]
  29.   return plist
  30. end
  31.  
  32. --This toggles the flashing object back  and forth at the desired speed while the mouse is not over it.
  33. --on prepareframe me
  34. --  if FlashSpeed <> 0 then
  35. --    if sprite(SpNum).cursor <> 280 then
  36. --      set TimeTracker = the ticks
  37. --      repeat while the ticks < TimeTracker + FlashSpeed
  38. --      end repeat
  39. --      if Glowing = 0 then
  40. --        sprite(SpNum).membernum = member(Hot).number
  41. --        Glowing = Glowing + 1
  42. --      else
  43. --        sprite(SpNum).membernum = member(MyNum).number
  44. --        Glowing = GLowing - 1
  45. --      end if
  46. --      updateStage
  47. --    end if
  48. --  end if
  49. --end
  50.  
  51. --This is for the rollover.
  52. on mouseenter me
  53.   sprite(SpNum).membernum = member(RollOvr).number
  54.   sprite(SpNum).cursor = 280  
  55.   updateStage  
  56. end
  57. on mouseleave me
  58.   sprite(SpNum).membernum = member(MyNum).number
  59.   sprite(SpNum).cursor = 293 
  60.   Glowing = 0
  61.   updateStage
  62. end
  63.  
  64. --This goes to another frame and tells the movie what to do. Also plays the sound, if any.
  65. on mousedown me
  66.   if WhichFrame <> 0 then
  67.     go to frame WhichFrame
  68.   else if MovieControl <> "No" then
  69.     sendallsprites (#MovieActionDown, MovieControl)  
  70.   end if
  71.   if  ButtonSound <> "" then
  72.     sound(2).play(member(ButtonSound)) 
  73.   end if
  74.   updatestage
  75. end
  76.  
  77. --This tells a movie what to do
  78. on mouseup me
  79. if MovieControl <> "No" then
  80. sendallsprites (#MovieActionUp, MovieControl)
  81. end if
  82. updatestage
  83. end
  84.  
  85.